package com.ft.web.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.ft.core.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;

/**
 * @copyright (C), 2015-2019, 梵途科技有限公司
 * @fileName: ApiResponse
 * @author: 李阳
 * @date: 2019/4/17 17:15
 * @description: API响应对象包装
 */
public class ApiResponse<TResult> extends AbstractResponse {
    private static final long serialVersionUID = -8577636340580499483L;

    /**
     * 响应结果
     */
    @Getter
    @Setter
    @JSONField(ordinal = 5)
    private TResult result;

    @Override
    public Boolean getSuccess() {
        return true;
    }

    @Override
    public String getMsg() {
        if (StringUtils.isNullOrBlank(super.getMsg())) {
            return "操作成功";
        }
        return super.getMsg();
    }
}
